import http from "./request";

// /* 新品推荐页 */----------------------------------------------------------------------------------------------推荐*/
// home/recommendProduct/list
// 分页查询推荐
export const homeRNewProductList = (params?: newProductParams): PRES<any> => {
  console.log(params);
  return http.get("home/newProduct/list", { params });
};

// home/newProduct/update/sort/{id}
// 修改首页新品排序
export const newProductUpdateSort = (
  id: number,
  sort: number
): PRES<IReqSort> =>
  http.post(`home/newProduct/update/sort/${id}?sort=${sort}`);

// home/newProduct/delete
// 批量删除推荐品牌
export const newProductDelete = (ids: number[]): PRES<IReqSort> =>
  http.post(`home/newProduct/delete?ids=${ids}`);

// home/newProduct/update/recommendStatus
// 批量修改首页新品状态
export const newProductUpdateRecStatus = (
  ids: number[],
  recommendStatus: number
): PRES<IReqSort> =>
  http.post(
    `home/newProduct/update/recommendStatus?ids=${ids}&recommendStatus=${recommendStatus}`
  );

// 添加模态窗添加商品 获取舒数据
// product/list
export const getProductList = (params: any): PRES<newProList> => {
  return http.get("product/list", { params });
};

// 添加数据
// home/newProduct/create
export const constNewProCreate = (
  params: newProductModel[]
): PRES<IReqSort> => {
  console.log(params);
  return http.post(`home/newProduct/create`, params);
};
